home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-03-11 | 1.8 KB | 75 lines | [TEXT/PJMM] |
- unit MyFileSystemUtils;
-
- interface
-
- procedure MyResolveAliasFile (var fs: FSSpec);
- function MyGetCatInfo (vrn: integer; dirID: longInt; var name: string; index: integer; var pb: CInfoPBRec): OSErr;
- function MyFSMakeFSSpec (vrn: integer; dirID: longInt; name: str255; var fs: FSSpec): OSErr;
- procedure MyGetModDate (var fs: FSSpec; var moddate: longInt);
-
- implementation
-
- uses
- Aliases;
-
- procedure MyResolveAliasFile (var fs: FSSpec);
- var
- isfolder, wasalias: boolean;
- temp: FSSpec;
- gv: longInt;
- oe: OSErr;
- begin
- if (Gestalt(gestaltAliasMgrAttr, gv) = noErr) & (BTST(gv, gestaltAliasMgrPresent)) then begin
- temp := fs;
- oe := ResolveAliasFile(fs, true, isfolder, wasalias);
- if oe <> noErr then
- fs := temp;
- end;
- end;
-
- function MyGetCatInfo (vrn: integer; dirID: longInt; var name: string; index: integer; var pb: CInfoPBRec): OSErr;
- begin
- with pb do begin
- ioVRefNum := vrn;
- ioDirID := dirID;
- ioNamePtr := @name;
- ioFDirIndex := index;
- MyGetCatInfo := PBGetCatInfo(@pb, false);
- end;
- end;
-
- function MyFSMakeFSSpec (vrn: integer; dirID: longInt; name: str255; var fs: FSSpec): OSErr;
- var
- pb: CInfoPBRec;
- oe: OSErr;
- gv: longInt;
- begin
- if (Gestalt(gestaltFSAttr, gv) = noErr) & (BTST(gv, gestaltHasFSSpecCalls)) then begin
- oe := FSMakeFSSpec(vrn, dirID, name, fs);
- end
- else begin
- oe := MyGetCatInfo(vrn, dirID, name, 0, pb);
- if (oe = noErr) then begin
- fs.vRefNum := pb.ioVRefNum;
- fs.parID := pb.ioFlParID;
- fs.name := name;
- end;
- end;
- MyFSMakeFSSpec := oe;
- end;
-
- procedure MyGetModDate (var fs: FSSpec; var moddate: longInt);
- var
- oe: OSErr;
- pb: CInfoPBRec;
- begin
- oe := MyGetCatInfo(fs.vRefNum, fs.parID, fs.name, 0, pb);
- if oe = noErr then begin
- moddate := pb.ioFlMdDat
- end
- else begin
- moddate := $80000000;
- end;
- end;
-
- end.